﻿namespace Pibby.Core.IO
{
	using System.IO;
	using System.Reflection;
	using System.Text;

	public static class ResourceReader
	{
		public static string ReadTextFromResource(Assembly assembly, string resourcePath)
		{
			string text = string.Empty;

			using (Stream s = assembly.GetManifestResourceStream(resourcePath))
			{
				if (s != null)
				{
					using (StreamReader sr = new StreamReader(s, Encoding.Default))
					{
						text = sr.ReadToEnd();
					}
				}
			}

			return text;
		}
	}
}
